#include<bits/stdc++.h>

using namespace std;

void print(int *a, int n) {
    for (int i = 0; i < n; i++)cout << a[i] << " ";
    cout << endl;
}

int main() {
    int a[] = {0, 0, 1, 2, 2, 2, 2, 2, 4, 4, 5, 5, 6};
    int n = sizeof(a) / sizeof(a[0]);
    int key = 4;

    cout << binary_search(a, a + n, key) << endl;
    int left = lower_bound(a, a + n, key) - a;
    int right = upper_bound(a, a + n, key) - a;
    cout << right - left << endl;

    return 0;
}
